
import plotsvcPkg from './plotservice.js'
var plotsvc = plotsvcPkg.PlotSvc;

var DBLClickPlotTool = {

}

DBLClickPlotTool.action = function (dataManger, mosEvnt, mousePt) {
    var pCurentGraph = dataManger.getCurentGraph();
    if (pCurentGraph){
        dataManger.recordRepaintScope(pCurentGraph);
    }
    if (pCurentGraph != null
        && pCurentGraph.getStart() == 1
        && pCurentGraph.getUseful() == 1
        && pCurentGraph.getFinish() == 0) {
            
        pCurentGraph.act2Mouse(mosEvnt, mousePt);

        var mayConnGraph = dataManger.pickGraph(mousePt);
        if (mayConnGraph) {
            var scaling = dataManger.getScaling();
            plotsvc.connect2DstGraph(dataManger.getTopoManager(),mousePt, pCurentGraph, mayConnGraph, 0, scaling);
        }

        if (pCurentGraph.getStart() == 1 && pCurentGraph.getFinish() == 1) {
            dataManger.getAuxDataManager().hideAuxiliaryGraph();
        }
    }
    if (pCurentGraph){
        dataManger.recordRepaintScope(pCurentGraph);
    }
}

export default { DBLClickPlotTool }